import { ElMessage, ElNotification } from 'element-plus'

const $message = {
  success (msg) {
    return ElMessage({
      message: msg,
      duration: 1500,
      center: true,
      type: 'success'
    })
  },
  info (msg) {
    return ElMessage({
      message: msg,
      duration: 1500,
      center: true,
      type: 'info'
    })
  },
  warning (msg) {
    return ElMessage({
      message: msg,
      duration: 1500,
      center: true,
      type: 'warning'
    })
  },
  error (msg) {
    return ElMessage({
      message: msg,
      duration: 1500,
      center: true,
      type: 'error'
    })
  }
}
const $notification = {
  success (msg, title = 'Success') {
    return ElNotification({
      title: title,
      message: msg,
      type: 'success',
      duration: 1500
    })
  },
  info (msg, title = 'Info') {
    return ElNotification({
      title: title,
      message: msg,
      type: 'info',
      duration: 1500
    })
  },
  warning (msg, title = 'Warning') {
    return ElNotification({
      title: title,
      message: msg,
      type: 'warning',
      duration: 1500
    })
  },
  error (msg, title = 'Error') {
    return ElNotification({
      title: title,
      message: msg,
      type: 'error',
      duration: 1500
    })
  }
}
export {
  $message,
  $notification
}
